<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.linshuaishuai.com" prefix="s" %>
<!DOCTYPE html>
<html>
<head>
<title><decorator:title default="林帅帅的博客系统" /></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="<c:url value="/resource/css/animation.css" />" type="text/css" >
<link rel="stylesheet" href="<c:url value="/resource/css/main.css" />" type="text/css" >
<link rel="stylesheet" href="<c:url value="/resource/css/article.css" />" type="text/css" >
<link rel="shortcut icon" href="<c:url value="/resource/image/logo.ico" />" type="image/ico">
<%@include file="/WEB-INF/view/script.jsp" %>
<script type="text/javascript" src="<c:url value="/resource/script/jquery.js" />"></script>
<script type="text/javascript" src="<c:url value="/resource/script/main.js" />"></script>
<script type="text/javascript" src="<c:url value="/resource/script/float-login.js" />"></script>
<decorator:head />
</head>
<body>
	<div class="wrapper">
		<div class="sidebar">
			<a class="logo" href="<c:url value="/" />">代码人生</a>
			<nav>
				<ul>
					<li class="title">文章类别</li>
					<c:choose>
						<c:when test="${currentCategory.id == \"all\"}">
							<li class="selected"><a href="<c:url value="/menu" />">所有文章</a></li>
						</c:when>
						<c:otherwise>
							<li><a href="<c:url value="/menu" />">所有文章</a></li>
						</c:otherwise>
					</c:choose>
					<c:forEach items="${categories}" var="category">
					<c:choose>
						<c:when test="${currentCategory.id == category.id}">
							<li class="selected"><a href="<c:url value="/menu/${category.id}" />"><c:out value="${category.name}"/></a></li>
						</c:when>
						<c:otherwise>
							<li><a href="<c:url value="/menu/${category.id}" />"><c:out value="${category.name}"/></a></li>
						</c:otherwise>
					</c:choose>
					</c:forEach>
				</ul>
			</nav>
			
			<nav class="control">
				<ul>
					<li class="title">操作中心</li>
					<c:choose>
						<c:when test="${user != null}">
						<li><button id="logout">安全退出</button></li>
						</c:when>
						<c:otherwise>
						<li><button id="login">登录系统</button></li>
						</c:otherwise>
					</c:choose>
					<s:authority authority="${user.authority}" indexs="1">
						<li><button id="create">新建文章</button></li>
					</s:authority>
					<s:authority authority="${user.authority}" indexs="2">
						<li>
							<form action="<c:url value="/system/upload" />" enctype="multipart/form-data" method="post">
								<button id="upload">上传文章</button>
								<input style="display: none;" id="upload_file" type="file" name="article" />
							</form>
						</li>
					</s:authority>
					<li><button id="reload">重新加载</button></li>
				</ul>
			</nav>
		</div>
		<div class="content">
			<div class="inner">
			<decorator:body/>
			</div>
		</div>
	</div>
</body>
</html>